import 'package:get/get.dart';
import 'package:note/manager/global.dart';
import 'package:note/manager/localAuthUtil.dart';
import 'package:note/models/appSetModel.dart';
import '../../common/strings.dart';
import '../../common/tools.dart';
import 'state.dart';

class SetLockLogic extends GetxController {
  final SetLockState state = SetLockState();

  void onLockApp() {
    LocalAuthUtil.instance.onUnlock().then((value) {
      if (value) {
        AppSetModel newSet = GlobalUtil.appSet.value;
        newSet.isLocked = !newSet.isLocked;
        GlobalUtil.setAppSet(newSet);
        Toasts.showToast(Strings.success);
      }
    });
  }
}
